Skip to content

Track BackupEngine and BackupStorageHandle errors together.#6350

Merged
deepthi merged 8 commits intovitessio:masterfrom
tinyspeck:am_be_error_recorder
Jun 22, 2020
Merged

Track BackupEngine and BackupStorageHandle errors together.#6350
deepthi merged 8 commits intovitessio:masterfrom
tinyspeck:am_be_error_recorder

Conversation

@ajm188
Copy link
Copy Markdown
Contributor

@ajm188 ajm188 commented Jun 21, 2020

This addresses #6349.

This change requires BackupHandle to implement the concurrency.ErrorRecorder interface in order to guarantee that errors that happen either in the backup engine code or in the backup storage handle code end up in the same place. This provides a single place for builtinbackupengine to check for errors before proceeding with writing the manifest.

This also required adding ErrorRecorder to certain BackupStorage implementations that didn't previously need them (filebackupstorage, gcsbackupstorage), and allowed me to turn simplify some calls (i.e. bh.errors.HasErrors() becomes bh.HasErrors()) in other implemtations (s3backupstorage, azblobbackupstorage, cephbackupstorage).

Finally, I added a test for the builtinbackupengine+s3backupstorage error case, which required me to change the typing of S3BackupHandle.client from *s3.S3 to the recommended s3iface.S3API which is just the interface that *s3.S3 implements.

Andrew Mason added 5 commits June 21, 2020 09:14
(Yes, I need to document, and also fix the interface implementation for
all the other implementations of BackupHandle)

Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
The `s3iface` type is an interface listing all the methods that the `s3`
struct implements, with the added benefit of being able to swap in mock
implementations in tests.

Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
@ajm188 ajm188 requested a review from sougou as a code owner June 21, 2020 16:58
@ajm188 ajm188 requested a review from deepthi June 22, 2020 17:33
Copy link
Copy Markdown
Collaborator

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! +100 for writing a unit test.
It will be nice to reword the long comment so that it works as a standalone explanation without reference to the diff.

Andrew Mason and others added 2 commits June 22, 2020 14:40
Co-authored-by: Deepthi Sigireddi <deepthi.sigireddi@gmail.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
Signed-off-by: Andrew Mason <amason@slack-corp.com>
@ajm188 ajm188 force-pushed the am_be_error_recorder branch from f8952ef to 3c3822c Compare June 22, 2020 18:51

wc, err := bh.AddFile(aws.BackgroundContext(), "somefile", 100000)
require.NoErrorf(t, err, "AddFile() expected no error, got %s", err)
assert.NotEqual(t, nil, wc, "AddFile() expected non-nil WriteCloser")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also an assert.NotNil, but I'll accept this.

Signed-off-by: Andrew Mason <amason@slack-corp.com>
@deepthi deepthi merged commit 7a1469b into vitessio:master Jun 22, 2020
ajm188 pushed a commit to tinyspeck/vitess that referenced this pull request Jun 26, 2020
Track BackupEngine and BackupStorageHandle errors together.
@deepthi deepthi added this to the v7.0 milestone Jul 27, 2020
ameetkotian pushed a commit to tinyspeck/vitess that referenced this pull request Aug 19, 2020
Track BackupEngine and BackupStorageHandle errors together.
@ajm188 ajm188 deleted the am_be_error_recorder branch January 14, 2021 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants